<!--  -->
<template>
    <div class="box">
        <div class="top">
            <p class="title">男女比例</p>
            <p class="bg"></p>
        </div>
        <div class="people">
            <div class="man">
                <img src="../../images/man.png" alt="">
            </div>
            <div class="men">
                <img src="../../images/woman.png" alt="">
            </div>
        </div>
        <div class="rate">
            <p>男士58%</p>
            <p>女士42%</p>
        </div>
        <div class="charts" ref="charts"></div>
    </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import * as echarts from "echarts"

//获取图形图标的dom节点
let charts = ref();

onMounted(() => {
    //初始化echarts实例
    let mycharts = echarts.init(charts.value);
console.log(mycharts);

    mycharts.setOption({
        title: {
            text: '男女比例',
            textStyle: {//主标题颜色
                color: 'skyblue'
            },
            left: '40%'

        },
        xAxis: {
            show: false,
            min: 0,
            max: 100,

        },
        yAxis: {
            show: false,
            type: 'category',
        },
        series: [
            {
                type: 'bar',
                data: [58],
                barWidth: 20,
                z: 100,
                itemStyle: {
                    color: '#007AFE',
                    borderRadius: 20
                }

            },
            {
                type: 'bar',
                data: [100],
                barWidth: 20,
                //调整女士柱状位置
                barGap: '-100%',
                itemStyle: {
                    color: '#FF4B7A',
                    borderRadius: 20

                }
            }
        ],
        grid: {
            left: 0,
            top: 0,
            bottom: 0,
            right: 0,

        }
    })

})



</script>

<style lang="scss" scoped>
.box {
    background: url(../../images//dataScreen-main-lc.png) no-repeat;
    background-size: 100% 100%;

    .top {
        .title {
            color: #ffffff;
            font-size: 16px;
            font-style: italic;

        }

        .bg {
            width: 68px;
            height: 7px;
            margin-top: 10px;
            background: url(../../images/dataScreen-title.png) no-repeat;
            background-size: 100% 100%;
        }



    }

    .people {
        margin-top: 80px;
        display: flex;
        justify-content: space-around;

        .man {
            width: 111px;
            height: 115px;
            background: url(../../images/man-bg.png) no-repeat;
            background-size: 100% 100%;
            display: flex;
            justify-content: center;
            align-items: center;

        }

        .men {
            width: 111px;
            height: 115px;
            background: url(../../images/woman-bg.png) no-repeat;
            background-size: 100% 100%;
            display: flex;
            justify-content: center;
            align-items: center;

        }
    }

    .rate {
        // margin-top: 80px;
        display: flex;
        color: aliceblue;
        justify-content: space-around;
    }
    .charts{
        width: 80%;
        margin-left: 10%;
        height: 100px;
    }
}
</style>